import { ContentTypeEnum } from '/@/enums/httpEnum';
import { defHttp } from '/@/utils/http/axios';

enum Api {
  getroleList = '/admin-api/system/role/page',
  getroleAdd = '/admin-api/system/role/create',
  getroleEdit = '/admin-api/system/role/update',
  getroleDelete = '/admin-api/system/role/delete',
  getmenuList = '/admin-api/system/menu/list',
  getmenuAssign = '/admin-api/system/permission/assign-role-menu',
  getmenuAssignInfo = '/admin-api/system/permission/list-role-resources',
  getRoleDataAssign = '/admin-api/system/permission/assign-role-data-scope',

}

/**
 * @description: 获用户
 */
export const roleList = (params: any) => {
  return defHttp.get<any>({ url: Api.getroleList, params });
};
export const addRole = (params: any) => {
  return defHttp.post<any>({ url: Api.getroleAdd, params });
};
export const editRole = (params: any) => {
  return defHttp.put<any>({ url: Api.getroleEdit, params });
};
export const deleteRole = (params: any) => {
  return defHttp.delete<any>({ url: Api.getroleDelete, params,headers:{'Content-Type':ContentTypeEnum.FORM_URLENCODED} });
};
export const menuList = (params: any) => {
  return defHttp.get<any>({ url: Api.getmenuList, params });
};
export const assignRole = (params: any) => {
  return defHttp.post<any>({ url: Api.getmenuAssign, params });
};
export const assignRoleInfo = (params: any) => {
  return defHttp.get<any>({ url: Api.getmenuAssignInfo, params });
};
export const roleDataAssign = (params: any) => {
  return defHttp.post<any>({ url: Api.getRoleDataAssign, params });
};